package com.wlf.admin.module.controller;


import com.wlf.admin.common.dto.ParamPage;
import com.wlf.admin.common.util.AjaxBean;
import com.wlf.admin.module.domain.PayOrder;
import com.wlf.admin.module.service.PayOrderService;
import com.wlf.admin.system.service.SysOrganService;
import com.wlf.admin.system.service.SysUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/pay")
public class PayController {
    @Resource
    private PayOrderService orderService;
    @Resource
    private SysOrganService organService;
    @Resource
    private SysUserService userService;

    @GetMapping("/main")
    ModelAndView indexHtml() {
        ModelAndView view = new ModelAndView("pay/index");
        view.addObject("organTree", organService.getTreeByLoginUserJsonStr());
        view.addObject("userList", userService.list());
        return view;
    }

    @PostMapping("/list")
    AjaxBean list(PayOrder order, ParamPage paramPage) {
        return orderService.getList(order, paramPage);
    }
}
